<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!--edge浏览器H5兼容设置-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--360浏览器H5兼容设置-->
    <meta name="renderer" content="webkit" />
    <title>客户端</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--导入核心文件-->
<!--    <script src="../bootstrap3/js/holder.js"></script>-->
    <link href="../bootstrap3/css/bootstrap.css" rel="stylesheet" type="text/css">
<!--    <script src="../bootstrap3/jquery-1.9.1.min.js"></script>-->
<!--    <script src="../bootstrap3/js/bootstrap.js"></script>-->
    <!-- 字体图标 -->
    <link rel="stylesheet" href="../bootstrap3/font-awesome-4.7.0/css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="../css/top.css" />
    <link rel="stylesheet" type="text/css" href="../css/index.css" />
<!--    <link rel="stylesheet" type="text/css" href="../css/layout.css" />-->
    <link rel="stylesheet" type="text/css" href="../css/login.css" />
    <link rel="stylesheet" type="text/css" href="../css/footer.css" />
    <script src="../bootstrap3/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/autoLogin.js" type="text/javascript"></script>
</head>
<body>
<!--头部-->
<header class="header">
    <img src="../images/index/stumalllogo.png" alt="" />
    <h1 class="pull-right">跨网络动态业务流验证技术<b>客户端</b></h1>
</header>
<!--主体-->
<div class="container mycontent text-left">
    <!--透明层 -->
    <div class="loginDiv">
        <p>用户登录</p>
        <!--表单开始-->
        <form id="form-login" action="index.html"  class="form-horizontal" role="form">
            <!--用户名-->
            <div class="form-group">
                <label for="username" class="col-md-3 control-label">名字：</label>
                <div class="col-md-8">
                    <input name="username" type="text" class="form-control" id="username"  placeholder="请输入用户名">
                </div>
            </div>
            <!--密码-->
            <div class="form-group">
                <label for="password" class="col-md-3 control-label"> 密码：</label>
                <div class="col-md-8">
                    <input name="password" type="text" class="form-control" id="password"  placeholder="请输入密码">
                </div>
            </div>
            <!--提交按钮-->
            <div class="form-group">
                <label class="col-md-3 control-label"></label>
                <div class="col-md-8">
                    <input id="btn-login" class="btn btn-primary" type="button" value="登录" />
                </div>
            </div>
        </form>
    </div>
</div>
<!--页脚开始-->
<footer class="footer">
    <div class="text-center rights container">
        <div class="col-md-offset-4 col-md-2">
            <span class="fa fa-address-card-o"></span>
            <p>指导老师：桂小林</p>
        </div>
        <div class="col-md-2">
            <span class="fa fa-graduation-cap"></span>
            <p>学生：李佳柠</p>
        </div>
    </div>
</footer>
<!--页脚结束-->

<script type="text/javascript">
    // 自动检测页面上的点击事件(监听哪个控件、做什么业务)
    $("#btn-login").click(function (){
        $.ajax({
            url: "/users/login",
            type: "POST",
            data: $("#form-login").serialize(),
            dataType: "JSON",
            success : function (json) {
                if (json.state == 200) {
                    alert("登录成功");
                    // 如果登录成功跳转到系统主页index.html
                    location.href = "Client.html";
                } else {
                    alert("登录失败");
                }
            }
        });
    });
</script>
</body>
</html>